Socket
Socket
Sign inDemoInstall

uri-js

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uri-js

An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.


Version published
Weekly downloads
42M
increased by3.76%
Maintainers
1
Weekly downloads
 
Created

What is uri-js?

The uri-js package is a utility for working with URIs (Uniform Resource Identifiers) in JavaScript. It provides functions for parsing, serializing, normalizing, and resolving URIs, as well as working with individual URI components.

What are uri-js's main functionalities?

Parsing URIs

This feature allows you to parse a URI string into its components, such as scheme, authority, path, query, and fragment.

const URI = require('uri-js');
const parsedURI = URI.parse('https://example.com:8080/path?query=string#fragment');

Serializing URIs

This feature allows you to build a URI string from its individual components.

const URI = require('uri-js');
const components = {
  scheme: 'https',
  userinfo: 'user:pass',
  host: 'example.com',
  port: 8080,
  path: '/path',
  query: 'query=string',
  fragment: 'fragment'
};
const serializedURI = URI.serialize(components);

Normalizing URIs

This feature allows you to normalize a URI by converting it to its canonical form, which is useful for URI comparison.

const URI = require('uri-js');
const normalizedURI = URI.normalize('HTTP://EXAMPLE.COM:80/a/../b/./c%2f?%61');

Resolving URIs

This feature allows you to resolve a relative URI against a base URI, resulting in an absolute URI.

const URI = require('uri-js');
const baseURI = 'http://example.com/dir/';
const relativeURI = '../other';
const resolvedURI = URI.resolve(baseURI, relativeURI);

Other packages similar to uri-js

Keywords

FAQs

Package last updated on 10 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc